/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Extras;

import java.awt.Color;
import java.awt.Component;
import javax.swing.BorderFactory;
import javax.swing.JLabel;

import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author Francisco
 */
public class HeaderCellRenderer extends DefaultTableCellRenderer {

    private JLabel lbl;

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {
        lbl = (JLabel) super.getTableCellRendererComponent(table, value,
                true, true, row, column);
        lbl.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createEmptyBorder(1, 1, 1, 1),
                BorderFactory.createLineBorder(new Color(120,120,120), 1)));
        lbl.setBackground(new Color(255,200,200));
        lbl.setForeground(new Color(0,0,70));
        lbl.setHorizontalAlignment(JLabel.CENTER);
        return this;
    }
}
